#{extends 'head.html' /}
#{ set title:'蓝莲花 | 写日志'/}


<script charset="utf-8" src="@{'/public/javascripts/edit_tools/kindeditor-4.0.1/kindeditor-min.js'}"></script>
<script charset="utf-8" src="@{'/public/javascripts/edit_tools/kindeditor-4.0.1/lang/zh_CN.js'}"></script>
<link rel="stylesheet" href="/public/stylesheets/alert.css" type="text/css" />
   <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript" src="/public/javascripts/adu.alert.js"></script>
<script type="text/javascript">
	try{
		var editor;
		KindEditor.ready(function(K) {
			editor = K.create('textarea[name="logcontent"]', {
				resizeType : 2,
				allowPreviewEmoticons : false,
				allowImageUpload : false,
				items : [
					'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
					'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
					'insertunorderedlist', '|', 'emoticons', 'image', 'link','table','map','|','source','fullscreen' ]
			});		
		});
		
		html = editor.html();
		editor.sync();
		html = $('textarea[name="logcontent"]').val();
		editor.html('HTML');
	}catch(e){}
</script>

<!-- content 开始-->
<div class="cont">
	<div class="m2_b_c1">
    	<div class="m2c_a">日志标题：</div>
        <div class="m2c_b"><input id="logtitle" type="test"/></div>
    </div>
	<div style="margin-left:10px; margin-top:20px;">
		<p style="margin-left:25px; color:#666666;">
		    <textarea rows="10" cols="70" id="logcontent" name="logcontent"></textarea>
		</p>
		<p style="float:right;margin-right:345px;margin-top:30px;"><a id="sbu"  href="javascript:void(0);"><img src="/public/indexFile/images/stu_10.gif"></a></p>
		<p style="margin-left:25px;margin-top:20px;"><span>阅读权限：</span><input type="radio" checked="checked" name = "perim" />所有人<input type="radio" name = "perim" />好友<input type="radio" name = "perim" />自己</p>
	</div>
	<script type="text/javascript">
		$("#sbu").click(function(){
			editor.sync();
			$.ajax({
				type:'post',
				url :'/controllers/Members.addlog',
				data:({"logtitle":$("#logtitle").val(),"logcontent":$("#logcontent").val()}),
				dataType:'html',
				success:function(e){
					if(e == "1"){
						aduAlert("添加日志成功！","提示",function(){
							window.location.href = "/controllers/Members.mybook?uid=${uid}";
						});
					}
					if(e == "0"){
						aduAlert("添加日志失败！","提示");
					}
				}
			});
		});
	</script>
</div>